package com.unitedvision.persistence.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.unitedvision.persistence.domain.CompanyCustomerEntity;
import com.unitedvision.persistence.domain.CompanyEntity;
import com.unitedvision.persistence.domain.OperatorEntity;
import com.unitedvision.persistence.domain.PaymentEntity;
import com.unitedvision.persistence.domain.PeriodeValue;

public interface PaymentRepository extends JpaRepository<PaymentEntity, Integer> {
	List<PaymentEntity> findByCompanyCustomer(CompanyCustomerEntity customerEntity);
	List<PaymentEntity> findByOperator(OperatorEntity operatorEntity);
	@Query ("select p from PaymentEntity p where p.periode = ?1 and p.operator.company = ?2")
	List<PaymentEntity> findByPeriodeAndCompany(PeriodeValue periodeValue, CompanyEntity companyEntity);
	@Query ("select p from PaymentEntity p where p.operator.company = ?1")
	List<PaymentEntity> findByCompany(CompanyEntity companyEntity);
}
